load("//bazel:ray.bzl", "ray_cc_library")

ray_cc_library(
    name = "authentication_mode",
    srcs = ["authentication_mode.cc"],
    hdrs = ["authentication_mode.h"],
    visibility = ["//visibility:public"],
    deps = [
        "//src/ray/common:ray_config",
        "@com_google_absl//absl/strings",
    ],
)

ray_cc_library(
    name = "authentication_token",
    hdrs = ["authentication_token.h"],
    visibility = ["//visibility:public"],
    deps = [
        "//src/ray/common:constants",
        "@com_github_grpc_grpc//:grpc++",
    ],
)

ray_cc_library(
    name = "k8s_constants",
    hdrs = ["k8s_constants.h"],
    visibility = ["//visibility:public"],
)

ray_cc_library(
    name = "k8s_util",
    srcs = ["k8s_util.cc"],
    hdrs = ["k8s_util.h"],
    visibility = ["//visibility:public"],
    deps = [
        ":authentication_token",
        ":k8s_constants",
        "//src/ray/util:logging",
        "@boost//:asio_ssl",
        "@boost//:beast",
        "@nlohmann_json",
    ],
)

ray_cc_library(
    name = "authentication_token_loader",
    srcs = ["authentication_token_loader.cc"],
    hdrs = ["authentication_token_loader.h"],
    visibility = ["//visibility:public"],
    deps = [
        ":authentication_mode",
        ":authentication_token",
        ":k8s_constants",
        "//src/ray/util:logging",
    ],
)

ray_cc_library(
    name = "token_auth_client_interceptor",
    srcs = ["token_auth_client_interceptor.cc"],
    hdrs = ["token_auth_client_interceptor.h"],
    visibility = ["//visibility:public"],
    deps = [
        ":authentication_token",
        ":authentication_token_loader",
        "//src/ray/common:constants",
        "@com_github_grpc_grpc//:grpc++",
    ],
)

ray_cc_library(
    name = "authentication_token_validator",
    srcs = ["authentication_token_validator.cc"],
    hdrs = ["authentication_token_validator.h"],
    visibility = ["//visibility:public"],
    deps = [
        ":authentication_mode",
        ":authentication_token",
        ":k8s_util",
    ],
)
